package net.xdclass.exception;

import lombok.Data;
import net.xdclass.enums.BizCodeEnum;

/**
 * @Author NJUPT wly
 * @Date 2021/9/13 10:43 上午
 * @Version 1.0
 */
@Data
public class BizException extends RuntimeException{

    private int code;
    private String message;

    public BizException(int code,String message){
        super(message);
        this.code = code;
        this.message = message;
    }

    public BizException(BizCodeEnum bizCodeEnum){
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.message = bizCodeEnum.getMessage();
    }
}
